package IC.lir.operands;

/**
 * Represents a label operand
 */
public class Label extends ImmOperand {

	private final String name;
	private static int count = 0;

	/**
	 * Create a unique, counted, label operand
	 */
	public Label() {
		this.name = "_label" + count++;
	}

	/**
	 * Create a label operand with a given name
	 * @param name the label name
	 */
	public Label(String name) {
		this.name = name;
	}

	/**
	 * @return the name of the label
	 */
	public String getName() {
		return name;
	}
	
	@Override
	public int getPrio() {
		return 0;
	}
	
	public String toString() {
		return name;
	}
	
	public int hashCode() {
		return name.hashCode() ^ getPrio();
	}
}
